package com.hanxry.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hanxry
 */
@Slf4j
@RestController
@RequestMapping("test")
public class TraceTestController {
    @GetMapping
    public String test() {
        log.info("调用接口Test");
        ThreadPoolTaskExecutor executor = ApplicationContextUtil.getBean(ThreadPoolTaskExecutor.class);
        for (int i = 0; i < 5; i++) {
            executor.execute(() -> log.info("子线程执行喽"));
        }
        return "Hello World";
    }
}
